package com.ghpt.controller;
import com.ghpt.pojo.GongRe;
import com.ghpt.service.GongReService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/gongre")
public class GongReController {
    private final GongReService gongReService;

    public GongReController(GongReService gongReService) {
        this.gongReService = gongReService;
    }
    @GetMapping("/{id}")
    public GongRe getGongReById(@PathVariable Long id) {
        System.out.println("结果是"+gongReService.findGongReById(id));
        return gongReService.findGongReById(id);
    }
    @PutMapping
    public int updateGongRe(@RequestBody GongRe gongRe) {
        return gongReService.updateById(gongRe);
    }
}
